#pragma once
#include "../BondMarketStream.h"
#include "qbprotocol/include/SSIDBModel.h"
namespace detail {
class MSUtil {
 public:
  static bool IsBondRelativeTerm(const CBondInfo& info);
  static bool IsBondRelativeType(const CBondInfo& info);
  static double CalcRemainingDay(const std::string& sPeriod);
  static void DecodeMarketStreamUnit(MarketStreamInfo& stInfo,
                                     const xQBMarketStreamUnit_c& unit);
  static void DecodeFIMarketStreamUnit(MarketStreamInfo& stInfo,
                                       const QbFixedIncomeDeal_c& unit);

  static CMarketStream::MarktType GetMarketStreamType(const char* szSubType,
                                                      const char* szRateType);
  static bool SortMarketRecord(
      const std::map<std::string, MarketStreamRec>& mapRecordTp,
      CMarketToprec& RecordInfo, CMarketToprec& MarketInfo, UINT nActvNum);
  static bool InsertMarketRecord(
      const char* combondKey, const MarketStreamRec& rec,
      std::map<std::string, MarketStreamRec>& mapRecordTp);
  static bool DeletePrice(const MarketStreamInfo& info, MarketStreamRec& stRec);
  static bool CaculateRecordPrice(MarketStreamRec& stRec,
                                  const MarketStreamInfo& info);
  static bool CaculateRecordPrice(
      MarketStreamRec& stRec, const char* bondKey,
      const char* listMarket /*, const char* bondCode*/, const char* price);

  static bool GetTodayMarketRecord(CMarketToprec& MarketInfo,
                                   const CMarketStreamlst& lst, UINT nActvNum);
};
}  // namespace detail
